import os
import re
import datetime
from MysqlHelp import DB

if __name__ == '__main__':
        # filepath = 'F:/wav/noise/'
        # pathDir = os.listdir(filepath)
        # for allDir in pathDir:
        #     child = os.path.join('%s%s' % (filepath, allDir))
        #     print(child)# .decode('gbk')是解决中文显示乱码问题
        #     code = "ffmpeg -i "
        #     codeMid = " -ac 1 -ar 8000 -y "
        #     outputname= "F:/wav/noise/pcm/"+"n"+os.path.basename(child)
        #     finishcode = code + child + codeMid +outputname
        #     os.system(finishcode)


        
        with DB(host='47.92.33.19',user='root',passwd='1qazxsw2',db='database_fm') as db:
            db.execute("SELECT id,radio_file_path,sound_markup from fm_t_scan_record "+
                    " WHERE sound_markup IS NULL and radio_file_path != 'undefined' and id % 2 = 1 "+
                    " ORDER BY id DESC limit 100")
            filelist = db.fetchall()
            for f in filelist:
                file = os.path.basename(str(f.values()))
                print(file.split('_')[3])
